import { TitleTextAlignEnum, TitleTextVAlignEnum } from "@/enums"
import { BorderType } from "@/types"

export type StringOrNumber = string | number 

export interface UseAttrsPanelStoreData {
  text: string
  subText: string
  show: boolean
  textAlign: TitleTextAlignEnum
  /** 标题垂直对齐方式 */
  textVerticalAlign: TitleTextVAlignEnum
  /** 是否触发事件 */
  triggerEvent: boolean
  padding: number
  /** 主副标题之间的高度 */
  itemGap: number
  /** title 组件离容器边侧的距离 */
  left: StringOrNumber
  top: StringOrNumber
  right: StringOrNumber
  bottom: StringOrNumber
  /** 标题背景色，默认透明 */
  backgroundColor: string
  /** 字体样式 */
  textStyle: TextStylesAttrs
}

export interface TextStylesAttrs extends Record<string, any> {
  color: string
  fontStyle: 'normal' | 'italic' | 'oblique'
  fontWeight: StringOrNumber
  fontSize: number
  fontFamily: 'serif' | 'monospace' | 'Arial'| 'Courier New' | 'Microsoft YaHei',
  width?: number
  height?: number
  /** 文字本身的描边颜色 */
  textBorderColor: string
  textBorderWidth: number
  textBorderType: BorderType
  ellipsis: string
  overflow: 'truncate' | 'break' | 'breakAll'
  rich: Record<string, any>
}


export interface UseAttrsPanelStoreFnc {
  setAttrs: <T = any>(key: string, value: T) => void
  setTextStylesAttrs: <T>(key: string, value: T) => void
}

export interface AxisDataCustom {
  value: string
  textStyle?: TextStylesAttrs
}